Electronic documents have proliferated as computers have become common fixtures in offices, schools, and homes. In many instances, electronic documents have replaced paper documents. To facilitate the use of an electronic document as a replacement for a paper document, the text of an electronic document must be legible and linguistically accurate. The text of an electronic document is typically rendered using one or more fonts. Examples of fonts include Arial, Times New Roman, and Courier. A font is a particular style of typeface. A font designed for an electronic document is designed to increase the readability of the document when displayed on a pixel display device, such as a monitor or a printer. To render the text of an electronic document in a particular font, the text is represented on the display device by glyphs. A glyph is a representation of one or more characters. A single glyph may represent a single character such as the lower case letter "f" or a single glyph may represent a string of characters such as the ligature "fi". To render a document on a display device, the characters of the document are converted to glyphs, and the glyphs are displayed on the display device to create a run of text.
Typically, font information, including glyph information, is stored in memory as a set of font tables. For example, the OpenType Layout font standard promulgated by Microsoft Corporation, assignee of the present invention, includes five font tables for each OpenType Layout font: (1) a glyph substitution table, (2) a glyph position table, (3) a justification table, (4) a base line table, and (5) a glyph definition table. The OpenType Layout font tables support contextual mapping between characters and glyphs, including ligatures, positional forms, alternatives, and other substitutions. A font which implements the OpenType Layout standard may also include font tables which contain additional types of data, such as glyph outlines, metrics, bitmaps, mapping information, plus additional tables containing information for advanced typography.
A word processing program or other program (the client program or client) may use the information in the font tables to layout and render the text (glyphs) of an electronic document on a display device. In advanced typography, there may not be a one-to-one correlation between a text character and the glyph that represents that character on the display device. For example, in some fonts, the "&" character may have a number of different or alternative appearances when rendered as a glyph on a display device. Absent some mechanism to select the appropriate alternative glyph for a particular character, the client program is unable to take advantage of the full array of alternatives and possibilities presented by the font tables.
Another aspect of advanced typography relates to the positioning of glyphs when rendering a run of text. Complex glyph positioning becomes an issue in writing systems, such as Vietnamese, that use diacritical and other marks to modify the sound or meaning of characters. These writing systems require controlled placement of all marks in relation to one another for legibility and linguistic accuracy. Other writing systems require sophisticated glyph positioning for correct typographic composition. For instance, Urdu glyphs are calligraphic and connect to one another along a descending, diagonal text line that proceeds from right to left. To properly render Urdu, a text-processing client must modify both the horizontal (X) and the vertical (Y) positions of each glyph.
One glyph positioning standard for TrueType fonts uses only one value, advance, to specify a glyph's position for text layout. If glyphs are positioned with respect to a virtual "pen point" that moves along a base line of text, advance describes where to move the virtual pen point to position the next glyph. For horizontal text, advance corresponds to the advance width in the X direction. TrueType fonts specify advance only in the X direction for horizontal layout and only in the Y direction for vertical layout. For simple Latin text layout, this value (advance) may be adequate to position glyphs correctly. But, for texts that require more sophisticated layout, the glyph positioning must cover a richer range. Additionally, the only positioning adjustment defined in the TrueType positioning model is pair kerning, which modifies the horizontal spacing between two glyphs. A typical kerning table lists pairs of glyphs and specifies how much space a text-processing client should add or remove between the glyphs to properly display each pair. It does not provide specific information about how to adjust the glyphs in each pair, and cannot adjust contexts of more than two glyphs.
In order to utilize the glyph rendering possibilities presented by alternative forms and complex positioning, the client program must be able to access and manipulate the font tables and the information contained in those tables. Such manipulation and utilization by the client program requires a level of complexity that may not be available in many client programs. Common interfaces handling sophisticated glyph positioning do not currently exist because there are only a few fonts that contain the advanced layout information. Some client programs, such as the "WINDOWS 95 ME" and the "WINDOWS 95 FE" operating systems, use advanced layout information contained in some system fonts, but those programs do so by parsing and interpreting the font data themselves. Therefore, many of the advanced typography features, such as alternative forms and complex glyph positioning, while available in the font tables, have not been utilized by the client programs that cannot handle such levels of complexity.
Another glyph positioning standard, known as TrueType Open, supplies more control and flexibility for positioning glyphs by using placement values for both the X-direction and the Y-direction. The X-placement value and the Y-placement value are stored in a subtable, known as the pair adjustment positioning table ("PairPos") within the glyph position table. By using both the X-placement value and the Y-placement value, the client program can independently adjust each glyph in a pair either independently or in relation to one another, thereby offering more flexibility and precise control over glyph positioning. Additionally, for each glyph, the PairPos table explicitly describes the type, size, and direction of the adjustment. For example, to kern two glyphs horizontally, the subtable might include direction to reduce the total advance units of the first glyph by 20 units in the X direction, reduce the left side bearing of the second glyph by 20 units, or to do both by 10 units instead of 20. Although the PairPos subtable offers greater control over glyph placement, the PairPos subtable is still stored in the front table, and therefore is not fully utilized due to the client programs being unable to take advantage of the full array of possibilities presented by the font tables.
Accordingly, there is a need in the art for a more efficient method for rendering alternative glyph forms and positioning glyphs in a run of text.